Python/Python Mcq Set 4 Sample Test,Sample questions

Question:
 What will be the output of the following Python code snippet?

for i in ''.join(reversed(list('abcd'))):
    print (i)

1.a b c d

2.d c b a

3. error

4. None of the mentioned

Posted Date:-2021-12-30 13:56:29


Question:
 What will be the output of the following Python code snippet?

for i in [1, 2, 3, 4][::-1]:
    print (i)

1.1 2 3 4

2.4 3 2 1

3.error

4.none of the mentioned

Posted Date:-2021-12-30 13:55:58


Question:
 What will be the output of the following Python code?

d = {0: 'a', 1: 'b', 2: 'c'}
for i in d:
    print(i)

1. 0 1 2

2.a b c

3. 0 a 1 b 2 c

4.none of the mentioned

Posted Date:-2021-12-30 13:44:22


Question:
 What will be the output of the following Python code?

i = 1
while False:
    if i%2 == 0:
        break
    print(i)
    i += 2

1.1

2.1 3 5 7 …

3. 1 2 3 4 …

4. None of the mentioned

Posted Date:-2021-12-30 10:00:44


Question:
 What will be the output of the following Python code?

x = ['ab', 'cd']
for i in x:
    i.upper()
print(x)

1. [‘ab’, ‘cd’]

2. [‘AB’, ‘CD’]

3.[None, None]

4.none of the mentioned

Posted Date:-2021-12-30 09:56:28


Question:
 What will be the output of the following Python code?

x = ['ab', 'cd']
for i in x:
    x.append(i.upper())
print(x)

1.[‘AB’, ‘CD’]

2.[‘ab’, ‘cd’, ‘AB’, ‘CD’]

3. [‘ab’, ‘cd’]

4. None of the mentioned

Posted Date:-2021-12-30 09:57:14


Question:
What will be the output of the following Python code snippet?

for i in '':
    print (i)

1.None

2.(nothing is printed)

3.error

4.none of the mentioned

Posted Date:-2021-12-30 13:59:23


Question:
What will be the output of the following Python code snippet?

for i in 'abcd'[::-1]:
    print (i)

1. a b c d

2.d c b a

3. error

4.none of the mentioned

Posted Date:-2021-12-30 13:57:03


Question:
What will be the output of the following Python code snippet?

x = 'abcd'
for i in range(len(x)):
    i.upper()
print (x)

1.a b c d

2. 0 1 2 3

3.error

4.none of the mentioned

Posted Date:-2021-12-30 10:57:05


Question:
What will be the output of the following Python code snippet?

x = 'abcd'
for i in range(len(x)):
    i[x].upper()
print (x)

1. abcd

2.ABCD

3.error

4.none of the mentioned

Posted Date:-2021-12-30 10:57:54


Question:
What will be the output of the following Python code snippet?

x = 'abcd'
for i in range(len(x)):
    print(x)
    x = 'a'

1.a

2.abcd abcd abcd abcd

3. a a a a

4. None of the mentioned

Posted Date:-2021-12-30 10:59:05


Question:
What will be the output of the following Python code snippet?

x = 'abcd'
for i in range(len(x)):
    x = 'a'
    print(x)

1. a

2.abcd abcd abcd

3. a a a a

4.none of the mentioned

Posted Date:-2021-12-30 10:58:39


Question:
What will be the output of the following Python code snippet?

x = 'abcd'
for i in range(len(x)):
    x[i].upper()
print (x)

1.abcd

2.ABCD

3.error

4. None of the mentioned

Posted Date:-2021-12-30 10:57:32


Question:
What will be the output of the following Python code snippet?

x = 2
for i in range(x):
    x += 1
    print (x)

1. 0 1 2 3 4 …

2.0 1

3.3 4

4. 0 1 2 3

Posted Date:-2021-12-30 14:00:18


Question:
What will be the output of the following Python code snippet?

x = 2
for i in range(x):
    x -= 2
    print (x)

1. 0 1 2 3 4 …

2. 0 -2

3.0

4.error

Posted Date:-2021-12-30 14:00:46


Question:
What will be the output of the following Python code?

d = {0, 1, 2}
for x in d.values():
    print(x)

1.0 1 2

2.None None None

3. error

4. None of the mentioned

Posted Date:-2021-12-30 13:50:47


Question:
What will be the output of the following Python code?

d = {0, 1, 2}
for x in d:
    print(d.add(x))

1. 0 1 2

2. 0 1 2 0 1 2 0 1 2 …

3.None None None

4.none of the mentioned

Posted Date:-2021-12-30 13:52:02


Question:
What will be the output of the following Python code?

d = {0, 1, 2}
for x in d:
    print(x)

1. 0 1 2

2.{0, 1, 2} {0, 1, 2} {0, 1, 2}

3.error

4.none of the mentioned

Posted Date:-2021-12-30 13:51:14


Question:
What will be the output of the following Python code?

d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.keys():
    print(d[x])

1.0 1 2

2.a b c

3.0 a 1 b 2 c

4.none of the mentioned

Posted Date:-2021-12-30 13:47:36


Question:
What will be the output of the following Python code?

d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.values():
    print(d[x])

1. 0 1 2

2. a b c

3.0 a 1 b 2 c

4.none of the mentioned

Posted Date:-2021-12-30 13:50:07


Question:
What will be the output of the following Python code?

d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.values():
    print(x)

1.0 1 2

2. a b c

3.0 a 1 b 2 c

4.none of the mentioned

Posted Date:-2021-12-30 13:49:41


Question:
What will be the output of the following Python code?

d = {0: 'a', 1: 'b', 2: 'c'}
for x, y in d.items():
    print(x, y)

1. 0 1 2

2.a b c

3. 0 a 1 b 2 c

4.none of the mentioned

Posted Date:-2021-12-30 13:46:41


Question:
What will be the output of the following Python code?

d = {0: 'a', 1: 'b', 2: 'c'}
for x, y in d:
    print(x, y)

1. 0 1 2

2.a b c

3. 0 a 1 b 2 c

4. None of the mentioned

Posted Date:-2021-12-30 13:44:56


Question:
What will be the output of the following Python code?

for i in range(0):
    print(i)

1. 0

2.no output

3.error

4.none of the mentioned

Posted Date:-2021-12-30 13:52:29


Question:
What will be the output of the following Python code?

for i in range(2.0):
    print(i)

1. 0.0 1.0

2. 0 1

3.error

4.none of the mentioned

Posted Date:-2021-12-30 13:53:23


Question:
What will be the output of the following Python code?

for i in range(5):
    if i == 5:
        break
    else:
        print(i)
else:
    print("Here")

1. 0 1 2 3 4 Here

2.0 1 2 3 4 5 Here

3.0 1 2 3 4

4.1 2 3 4 5

Posted Date:-2021-12-30 14:01:37


Question:
What will be the output of the following Python code?

for i in range(float('inf')):
    print (i)

1.0.0 0.1 0.2 0.3 …

2.0 1 2 3 …

3.0.0 1.0 2.0 3.0 …

4.none of the mentioned

Posted Date:-2021-12-30 13:54:58


Question:
What will be the output of the following Python code?

for i in range(int(2.0)):
    print(i)

1.0.0 1.0

2. 0 1

3.error

4.none of the mentioned

Posted Date:-2021-12-30 13:54:34


Question:
What will be the output of the following Python code?

for i in range(int(float('inf'))):
    print (i)

1.0.0 0.1 0.2 0.3 …

2.0 1 2 3 …

3.0.0 1.0 2.0 3.0 …

4.none of the mentioned

Posted Date:-2021-12-30 13:55:23


Question:
What will be the output of the following Python code?

i = 0
while i < 3:
    print(i)
    i += 1
else:
    print(0)

1.0 1 2 3 0

2. 0 1 2 0

3. 0 1 2

4.error

Posted Date:-2021-12-30 10:02:21


Question:
What will be the output of the following Python code?

i = 0
while i < 5:
    print(i)
    i += 1
    if i == 3:
        break
else:
    print(0)

1.0 1 2 0

2.0 1 2

3. error

4.none of the mentioned

Posted Date:-2021-12-30 10:01:53


Question:
What will be the output of the following Python code?

i = 1
while True:
    if i%0O7 == 0:
        break
    print(i)
    i += 1

1. 1 2 3 4 5 6

2. 1 2 3 4 5 6 7

3.error

4.none of the mentioned

Posted Date:-2021-12-30 09:58:13


Question:
What will be the output of the following Python code?

i = 1
while True:
    if i%2 == 0:
        break
    print(i)
    i += 2

1.1

2.1 2

3.1 2 3 4 5 6 …

4. 1 3 5 7 9 11 …

Posted Date:-2021-12-30 09:59:57


Question:
What will be the output of the following Python code?

i = 2
while True:
    if i%3 == 0:
        break
    print(i)
    i += 2

1.2 4 6 8 10 …

2.2 4

3. 2 3

4.error

Posted Date:-2021-12-30 10:00:19


Question:
What will be the output of the following Python code?

i = 5
while True:
    if i%0O11 == 0:
        break
    print(i)
    i += 1

1. 5 6 7 8 9 10

2. 5 6 7 8

3. 5 6

4. error

Posted Date:-2021-12-30 09:58:41


Question:
What will be the output of the following Python code?

i = 5
while True:
    if i%0O9 == 0:
        break
    print(i)
    i += 1

1.5 6 7 8

2.5 6 7 8 9

3.5 6 7 8 9 10 11 12 13 14 15 ….

4.error

Posted Date:-2021-12-30 09:59:09


Question:
What will be the output of the following Python code?

i = 5
while True:
    if i%0O9 == 0:
        break
    print(i)
    i += 1

1.5 6 7 8

2.5 6 7 8 9

3.5 6 7 8 9 10 11 12 13 14 15 ….

4.error

Posted Date:-2021-12-30 09:59:14


Question:
What will be the output of the following Python code?

True = False
while True:
    print(True)
    break

1. True

2.False

3. None

4.none of the mentioned

Posted Date:-2021-12-30 10:01:07


Question:
What will be the output of the following Python code?

x = 'abcd'
for i in range(len(x)):
    print(i.upper())

1.a b c d

2. 0 1 2 3

3. error

4. 1 2 3 4

Posted Date:-2021-12-30 10:48:35


Question:
What will be the output of the following Python code?

x = 'abcd'
for i in range(x):
    print(i)

1. a b c d

2. 0 1 2 3

3.error

4.none of the mentioned

Posted Date:-2021-12-30 10:47:33


Question:
What will be the output of the following Python code?

x = 'abcd'
for i in x:
    print(i)
    x.upper()

1. a B C D

2.a b c d

3.A B C D

4.error

Posted Date:-2021-12-30 10:06:21


Question:
What will be the output of the following Python code?

x = "abcdef"
i = "a"
while i in x:
    print('i', end = " ")

1. no output

2. i i i i i i …

3. a a a a a a …

4.a b c d e f

Posted Date:-2021-12-30 10:03:53


Question:
What will be the output of the following Python code?

x = "abcdef"
i = "a"
while i in x:
    print(i, end = " ")

1.no output

2. i i i i i i …

3.a a a a a a …

4.a b c d e f

Posted Date:-2021-12-30 10:03:33


Question:
What will be the output of the following Python code?

x = "abcdef"
i = "a"
while i in x:
    x = x[1:]
    print(i, end = " ")

1. a a a a a a

2.a

3. no output

4. error

Posted Date:-2021-12-30 10:05:19


Question:
What will be the output of the following Python code?

x = "abcdef"
i = "a"
while i in x:
    x = x[:-1]
    print(i, end = " ")

1. i i i i i i

2. a a a a a a

3.a a a a a

4.none of the mentioned

Posted Date:-2021-12-30 10:04:24


Question:
What will be the output of the following Python code?

x = "abcdef"
i = "a"
while i in x[1:]:
    print(i, end = " ")

1. a a a a a a

2. a

3.no output

4. error

Posted Date:-2021-12-30 10:05:43


Question:
What will be the output of the following Python code?

x = "abcdef"
i = "a"
while i in x[:-1]:
    print(i, end = " ")

1.a a a a a

2.a a a a a a

3. a a a a a a …

4. a

Posted Date:-2021-12-30 10:04:48


Question:
What will be the output of the following Python code?

x = "abcdef"
i = "i"
while i in x:
    print(i, end=" ")

1. no output

2. i i i i i i …

3. a b c d e f

4.abcdef

Posted Date:-2021-12-30 10:03:08


Question:
What will be the output of the following Python code?

x = "abcdef"
while i in x:
    print(i, end=" ")

1.a b c d e f

2.abcdef

3. i i i i i i …

4.error

Posted Date:-2021-12-30 10:02:42


Question:
What will be the output of the following Python code?

x = 123
for i in x:
    print(i)

1.1 2 3

2.123

3.error

4.none of the mentioned

Posted Date:-2021-12-30 13:43:33


More MCQS

  1. Python MCQS - Function
  2. Python MCQS - GUI in python
  3. Python MCQS - Operators
  4. Python MCQS - Data type in python
  5. Python MCQS - loops in python
  6. Python MCQS - Numpy
  7. Python MCQS - sqlite3
  8. Python MCQS - Library
  9. Python MCQS - Pandas
  10. Python MCQs
  11. Dictionary Python MCQ set 1
  12. Dictionary Python MCQ set 2
  13. MCQ For Python Fundamentals
  14. MCQ Introduction to Python Section 1
  15. MCQ Introduction to Python Section 2
  16. MCQ Introduction to Python Section 3
  17. MCQ on Flow of Control in Python Set 1
  18. MCQ on Flow of Control in Python Set 2
  19. MCQ on Python String Set 1
  20. File Handling in Python section 1
  21. File Handling in Python section 2
  22. Python Functions MCQS Set 1
  23. Python Functions MCQS Set 2
  24. MCQ on List in Python
  25. Pandas MCQ Questions Set 1
  26. Pandas MCQ Questions Set 2
  27. Tuple MCQ in Python
  28. Python dataframe MCQ
  29. Python Mcq Set 1
  30. Python Mcq Set 2
  31. Python Mcq Set 3
  32. Python Mcq Set 4
  33. Python Mcq Set 5
  34. Python Mcq Set 6
  35. Python Mcq Set 7
  36. Python Mcq Set 8
  37. Python Mcq Set 9
  38. Python Mcq Set 10
  39. Python Mcq Set 11
  40. Python Mcq Set 12
  41. Python Mcq Set 13
  42. Python Mcq Set 14
  43. Python Mcq Set 15
  44. Python Mcq Set 16
  45. Python Mcq Set 17
  46. Python Mcq Set 18
  47. Python Mcq Set 19
  48. Python Mcq Set 20
  49. Python Mcq Set 21
  50. Python MCQ
  51. Python MCQ Questions with Answer
  52. Test
  53. python mcq question and answer
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!